/**
 * Proxy是一个类
 * 通过 new Proxy创建一个代理对象 操作代理对象而监听某些操作
 * */

const obj = {
  name:'cs',
  age:19
}

const objProxy = new Proxy(obj,{
  get(target,key ){
    console.log(`监听：${key}的获取`)
    return target[key]
  },
  set(target, p, newValue, receiver) {
    console.log(`监听：${p}的设置`)
    target[p] = newValue
  }
})
objProxy.name = 'hh'
console.log(objProxy.name)
console.log(obj,'obj',objProxy,'objProxy')